//
//  Payment.m
//  Opper
//
//  Created by Le Dung on 4/19/13.
//  Copyright (c) 2013 LeDung. All rights reserved.
//

#import "Payment.h"

@interface Payment ()

@end

@implementation Payment
@synthesize isMove;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


-(void)viewDidAppear:(BOOL)animated
{
    [StyleClass barButtonItemEdit:self left:YES right:NO];

}

-(void)leftPress
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    [StyleClass createNavi:self andTitle:@"Uw brief is verstuurd"];
    [StyleClass background:self.view];
    [self styleContaint];
    [self buttonTarget];
}

-(void)acceptPress
{
    Feedback *page=[[[Feedback alloc]init] autorelease];
    [StyleClass currentScreen:self andDestination:page andHideBackButton:YES];
}
-(void)cancelPress
{
    [self.navigationController  popViewControllerAnimated:YES];
}
-(void)buttonTarget
{
    [self.acceptButton addTarget:self action:@selector(acceptPress) forControlEvents:UIControlEventTouchUpInside];
    [self.acceptButton setBackgroundImage:[StyleClass nGreen] forState:UIControlStateNormal];
    
    
    [self.cancelButton addTarget:self action:@selector(cancelPress) forControlEvents:UIControlEventTouchUpInside];
    [self.cancelButton setBackgroundImage:[StyleClass nRed] forState:UIControlStateNormal];
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    if(isMove)
    {
        [StyleClass moveDown:self.containView andYLocation:80];
        isMove=0;
    }
    [textField resignFirstResponder];
    return YES;
}

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    if(!isMove)
    {
        [StyleClass moveUp:self.containView andYLocation:80];
        isMove=1;
    }
}
-(void)styleContaint
{
    [self.accountBank setBackground:[StyleClass nText ]];
    self.accountBank.delegate=self;
    [self.accountName setBackground:[StyleClass nText]];
    self.accountName.delegate= self;
    
    
    [self.containView setBackgroundColor:[UIColor whiteColor]];
    self.containView.layer.shadowColor = [[UIColor blackColor] CGColor];
    self.containView.layer.shadowOffset = CGSizeMake(0, 0.5);
    self.containView.layer.shadowOpacity = 1;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)dealloc {
    [_containView release];
    [_accountBank release];
    [_accountName release];
    [_acceptButton release];
    [_cancelButton release];
    [super dealloc];
}
@end
